﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using LibrarySolution.DB;

namespace LibrarySolution.DB
{
    class DBExecuteUtil:DBUtil
    {
        /// <summary>
        ///  执行查询,返回DataTable
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="sqlParas"></param>
        /// <returns></returns>
        public static DataTable querySqlGetTable(string sql, SqlParameter[] sqlParas)
        {
            return queryTable(sql, CommandType.Text, sqlParas);
        }
        /// <summary>
        ///  执行查询,返回交错数组
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="sqlParas"></param>
        /// <returns></returns>
        public static string[][] querySqlArray(string sql, SqlParameter[] sqlParas)
        {
            return convertTableToArray(querySqlGetTable(sql, sqlParas));
        }

        /// <summary>
        ///  查询无返回值
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="sqlParas"></param>
        public static void querySqlV(string sql, SqlParameter[] sqlParas)
        {
             ExecuteCMDV(sql, CommandType.Text, sqlParas);
        }
        /// <summary>
        ///  查询有返回值
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="sqlParas"></param>
        public static string querySql(string sql, SqlParameter[] sqlParas)
        {
            return ExecuteCMD(sql, CommandType.Text, sqlParas);
        }
    }
}
